package com.company.cloud.club.modules.vo;

import com.company.cloud.club.modules.constants.ClubMemberType;
import com.company.cloud.club.modules.core.util.ValidateUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class ClubVo implements Serializable {

    private String id;

    private String name;

    private String intro;

    private String img;

    private Integer virtualHuman;

    private Integer num;

    private Integer isSug;

    private Integer clubMasterId;

    private Boolean isColl;

    private ClubMemberVo master;

    private List<ClubMemberVo> directorList = new ArrayList<>();

    private List<ClubMemberVo> memberList = new ArrayList<>();

    private ActivityVo activityVo;

    private Integer sort;

    public ClubVo(String id, String name, String img) {
        this.id = id;
        this.name = name;
        this.img = img;
    }

    public ClubVo(String id, String name, String img, Integer num) {
        this.id = id;
        this.name = name;
        this.img = img;
        this.num = num;
    }

    public void addMember(ClubMemberVo member) {
        if (ValidateUtil.isValid(member)) {
            String type = member.getType();
            switch (type) {
                case ClubMemberType.MASTER:
                    setMaster(member);
                    break;
                case ClubMemberType.DIRECTOR:
                    directorList.add(member);
                    break;
                case ClubMemberType.MEMBER:
                    memberList.add(member);
                    break;
            }
        }
    }

}
